package com.itany.corejava.code07_面向对象.lianxi3;

/**
 * @author MissChen
 * @version 1.0
 * @date 2023 年11月07日 10:44
 */
public class Test {
    public static void main(String[] args) {

        // 子类-->父类-->子类
        Role role2=new Employee("陈诚",24,"男",7000);
        role2.show();
        if(role2 instanceof Employee){
            Employee e2=(Employee)role2;
            e2.sing();
        }


        // 孙子类-->爷爷类-->父类
        Role role=new Manager("雷雨净",20,"男",8000);
        role.show();


        System.out.println(role instanceof Employee); //true
        System.out.println(role instanceof Manager);//true

        ((Manager) role).sing();


    }
}
